package com.brid.controller;

import com.brid.domain.dto.UserDTO;
import com.brid.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;


/**
 * @Author: 司军强
 * @Date：2020/3/10 22:56
 * @Description: 模拟违章的crud实现
 */
@RestController
@RequestMapping(value = "/voilation")
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 将用户的信息保存到表中
     *
     * @return
     */
    @GetMapping(value = "/add/user")
    public String  addUser() {
        UserDTO userDTO = UserDTO.builder()
                .bonus("250")
                .avatarUrl("www.baidu.com")
                .roles("王者")
                .wxId("9527")
                .wxNickname("奋斗的小脑")
                .createTime(new Date())
                .updateTime(new Date()).build();
        userService.addUser(userDTO);
        return null;
    }

}
